Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

core/model/src/commonMain/kotlin/org/meshtastic/core/model/geofence/ActiveWaypoints.kt df62b4fd384a7d3fb867a2879aa8a14f10cd8a29 (df62b4fd) Text, 2.55 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.model.geofence

Tff7b72import T7ee787org.meshtastic.core.model.DataPacket
Tff7b72import T7ee787org.meshtastic.core.model.isFromLocal
Tff7b72import T7ee787org.meshtastic.proto.Waypoint

T8b949e/**
* Collapse a raw waypoint-packet list into the set of currently active waypoints, keyed by waypoint id.
*
* `PacketRepository.getWaypoints()` is a row-PER-TRANSMISSION firehose: every re-broadcast or edit inserts a new
* `packet` row (keyed on the random MeshPacket transmission id, not the semantic waypoint id). Consumers must normalise
* — latest transmission wins, expired waypoints dropped — or they will see duplicate/stale geofences and keep alerting
* on waypoints the user can no longer see. Both the map UI and the geofence engine go through here so they cannot
* drift. Rows are ordered oldest-first, so `associateBy` keeps the newest copy per id.
*/
Tff7b72fun Td2a8ffListTff7b72<Te6edf3DataPacketTff7b72>Tb4b4b4.Te6edf3activeWaypointPacketsTb4b4b4(Te6edf3nowSecondsTb4b4b4: Tffa657LongTb4b4b4)Tb4b4b4: Te6edf3MapTff7b72<Tffa657IntTb4b4b4, Te6edf3DataPacketTff7b72> Tff7b72= Te6edf3filter Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3waypoint Tff7b72!Tff7b72= Tff7b72null Tb4b4b4}
Tb4b4b4.Te6edf3associateBy Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3waypointTff7b72!!Tb4b4b4.Te6edf3id Tb4b4b4}
Tb4b4b4.Te6edf3filterValues Tb4b4b4{
Tff7b72val Te6edf3expire Tff7b72= Tffa657itTb4b4b4.Te6edf3waypointTff7b72?.Te6edf3expire Tff7b72?: T79c0ff0
Te6edf3expire Tff7b72=Tff7b72= T79c0ff0 Tff7b72|Tff7b72| Te6edf3expireTb4b4b4.Te6edf3toLongTb4b4b4(Tb4b4b4) Tff7b72> Te6edf3nowSeconds
Tb4b4b4}

T8b949e/**
* The geofences whose crossings THIS device should raise notifications for: waypoints we created ([isFromLocal]) plus
* any the user has explicitly opted into ([optedInIds]). Foreign geofences are excluded by default because waypoints
* are mesh-broadcast — every receiver stores them, so without this gate everyone in range would alert on the creator's
* crossings. Only waypoints that actually request crossing notifications ([notifiesOnCrossing]) survive.
*/
Tff7b72fun Td2a8ffCollectionTff7b72<Te6edf3DataPacketTff7b72>Tb4b4b4.Te6edf3geofencesToMonitorTb4b4b4(Te6edf3myNodeNumTb4b4b4: Tffa657Int?Tb4b4b4, Te6edf3optedInIdsTb4b4b4: Te6edf3SetTff7b72<Tffa657IntTff7b72>Tb4b4b4)Tb4b4b4: Te6edf3ListTff7b72<Te6edf3WaypointTff7b72> Tff7b72=
Te6edf3filter Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3isFromLocalTb4b4b4(Te6edf3myNodeNumTb4b4b4) Tff7b72|Tff7b72| Tb4b4b4(Tffa657itTb4b4b4.Te6edf3waypointTff7b72?.Te6edf3id Tff7b72in Te6edf3optedInIdsTb4b4b4) Tb4b4b4}
Tb4b4b4.Te6edf3mapNotNull Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3waypoint Tb4b4b4}
Tb4b4b4.Te6edf3filter Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3notifiesOnCrossing Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.07s